package com.masterviame.Authc.pojo;

import java.util.Date;
import java.util.List;

/**
 * Created by mastervictory on 2017/12/13.
 */
public class User {
    private long userid;
    private String username;
    private String password;
    private String roleCode;
    private boolean locked;
    private Date login;
    private List<Role> roles;

    public long getUserid() {
        return userid;
    }

    public void setUserid(long userid) {
        this.userid = userid;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public boolean isLocked() {
        return locked;
    }

    public void setLocked(boolean locked) {
        this.locked = locked;
    }

    public List<Role> getRoles() {
        return roles;
    }

    public void setRoles(List<Role> roles) {
        this.roles = roles;
    }

    public String getRoleCode() {
        return roleCode;
    }

    public void setRoleCode(String roleCode) {
        this.roleCode = roleCode;
    }

    public Date getLogin() {
        return login;
    }

    public void setLogin(Date login) {
        this.login = login;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        User user = (User) o;

        if (getUserid() != user.getUserid()) return false;
        if (isLocked() != user.isLocked()) return false;
        if (!getUsername().equals(user.getUsername())) return false;
        if (!getPassword().equals(user.getPassword())) return false;
        if (!getRoleCode().equals(user.getRoleCode())) return false;
        if (!getLogin().equals(user.getLogin())) return false;
        return getRoles().equals(user.getRoles());
    }

    @Override
    public int hashCode() {
        int result = (int) (getUserid() ^ (getUserid() >>> 32));
        result = 31 * result + getUsername().hashCode();
        result = 31 * result + getPassword().hashCode();
        result = 31 * result + getRoleCode().hashCode();
        result = 31 * result + (isLocked() ? 1 : 0);
        result = 31 * result + getLogin().hashCode();
        result = 31 * result + getRoles().hashCode();
        return result;
    }

    @Override
    public String toString() {
        return "User{" +
                "userid=" + userid +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", roleCode='" + roleCode + '\'' +
                ", locked=" + locked +
                ", login=" + login +
                ", roles=" + roles +
                '}';
    }
}
